#pragma once

/*
it's a basic class of a program
it needs to be inherited
you should override functions listed below:
	------------------------------------
		create_window
	------------------------------------
you should initialize the scenes needed in this function
*/

class Window
{
protected:
	int SCREEN_X;															//the width of the screen
	int SCREEN_Y;															//the height of the screen

	HWND hwnd;																//the handle of the window
	HINSTANCE hinst;														//the handle of the instance

	HDC hdc;																//the HDC of the window
	HDC memDC;																//the memory DC for gdiplus
	Gdiplus::Graphics * graphics;											//the graphics for memDC

	void get_and_dispatch_input();											//get inputs, and dispatches them to active scene
	Scene * curScene = nullptr;												//the active scene

private:
	virtual void create_window();											//create a window
	void generate_graphics();												//generate a graphics
	void init_gdip();														//initialize gdiplus

	bool frame();															//the frame function of the application

public:
	Window(HINSTANCE hinstance);											//constructor
	~Window();																//destructor

	int loop();																//begin the loop for process

	HWND get_hwnd() { return hwnd; }										//return the handle of the window
	HINSTANCE get_hinstance() { return hinst; }								//return the HINSTANCE of the application
	Gdiplus::Graphics * get_graphics() { return graphics; }					//return the graphics of the application

	void bind_scene(Scene * scene);											//bind an active scene
};

LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam);